<?php
class TeamController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    	$this->_helper->layout->setLayout ( 'layout' );

    }
    public function indexAction()
    {
    	
    	//Condition to retrieve all teams
			$criteria    = new Criteria();
			$oTeam = TeamPeer::doSelect($criteria);
			$this->view->team=$oTeam;
			
		//Retrieving teams data
			$oMatchTeam = TeamPeer::doSelectOne(new Criteria); 
			$oMatch     = Default_Service_Tournament::getTeamsMatches($oMatchTeam->getId());	
			$this->view->match      = $oMatch;
			$this->view->matchTeam  = $oMatchTeam;
			
		//Condtion to retrieve news
			$newsUrl = "http://in.news.yahoo.com/rss/cricket";
    		$str = simplexml_load_file($newsUrl); 
    		$this->view->xml 	  = $str;	
    }
	
    //function to display schedule based on teams
	public function displayscheduleAction()
	{
		//disabling layout
			$this->_helper->layout()->disableLayout();
		
		//Retrieving params
			$id  = $this->_getParam('id');
		
		//Retrieving teams data
			$oTeam  = TeamPeer::retrieveByPK($id); 
			$oMatch = Default_Service_Tournament::getTeamsMatches($id);

		//Sending data for view	
			$this->view->match  = $oMatch;
			$this->view->team   = $oTeam;
	}
	
}  